<%@ include file="../common/top.jsp"%>

<div id="Catalog">
<form action="finalOrder" method="get">
    <table>

        <tr>
            <th colspan=2>Payment Details</th>
        </tr>
        <tr>
            <td>Card Type:</td>
            <td name="order.cardType">${sessionScope.order.cardType}</td>
        </tr>
        <tr>
            <td>Card Number:</td>
            <td>${sessionScope.order.creditcard}</td>
        </tr>
        <tr>
            <td>Expiry Date (MM/YYYY):</td>
            <td>${sessionScope.order.exprdate}</td>

        </tr>

        <tr>
            <th colspan="2">Billing Address</th>
        </tr>
        <tr>
            <td>First name:</td>
            <td>${sessionScope.order.billToFirstName}</td>
        </tr>
        <tr>
            <td>Last name:</td>
            <td>${sessionScope.order.billToLastName}</td>
        </tr>
        <tr>
            <td>Address 1:</td>
            <td>${sessionScope.order.billAddress1}</td>
        </tr>
        <tr>
            <td>Address 2:</td>
            <td>${sessionScope.order.billAddress2}</td>
        </tr>
        <tr>
            <td>City:</td>
            <td>${sessionScope.order.billCity}</td>
        </tr>
        <tr>
            <td>State:</td>
            <td>${sessionScope.order.billState}</td>
        </tr>
        <tr>
            <td>Zip:</td>
            <td>${sessionScope.order.billZip}</td>
        </tr>
        <tr>
            <td>Country:</td>
            <td>${sessionScope.order.billCountry}</td>
        </tr>

<c:if test="${sessionScope.isShip}">
        <tr>
            <th colspan="2">Shipping Address</th>
        </tr>
        <tr>
            <td>First name:</td>
            <td>${sessionScope.order.shipToFirstName}</td>
        </tr>
        <tr>
            <td>Last name:</td>
            <td>${sessionScope.order.shipToLastName}</td>
        </tr>
        <tr>
            <td>Address 1:</td>
            <td>${sessionScope.order.shipAddress1}</td>
        </tr>
        <tr>
            <td>Address 2:</td>
            <td>${sessionScope.order.shipAddress2}</td>
        </tr>
        <tr>
            <td>City:</td>
            <td>${sessionScope.order.shipCity}</td>
        </tr>
        <tr>
            <td>State:</td>
            <td>${sessionScope.order.shipState}</td>
        </tr>
        <tr>
            <td>Zip:</td>
            <td>${sessionScope.order.shipZip}</td>
        </tr>
        <tr>
            <td>Country:</td>
            <td>${sessionScope.order.shipCountry}</td>
        </tr>
</c:if>

    </table>


    <table >
        <tr>
            <th><b>Item ID</b></th>
            <th><b>Description</b></th>
            <th><b>In Stock?</b></th>
            <th><b>Quantity</b></th>
            <th><b>Price</b></th>
            <th><b>Total Cost</b></th>

        </tr>
        <c:forEach var="cartItem" items="${sessionScope.cart.cartItems}">
            <tr>
                <td>
                        <%--            <a href="itemForm?itemId=${cartItem.item.itemId}"> ${cartItem.item.itemId}</a>--%>
                        ${cartItem.item.itemId}
                </td>
                <td>${cartItem.item.attribute1} ${cartItem.item.attribute2}
                        ${cartItem.item.attribute3} ${cartItem.item.attribute4}
                        ${cartItem.item.attribute5} ${cartItem.item.product.name}</td>
                <td>${cartItem.inStock}</td>
                <td>
                        ${cartItem.quantity}
                </td>
                <td><fmt:formatNumber value="${cartItem.item.listPrice}"
                                      pattern="$#,##0.00" /></td>
                <td><fmt:formatNumber value="${cartItem.total}"
                                      pattern="$#,##0.00" /></td>
            </tr>
        </c:forEach>
        <tr>
            <th></th>
            <th></th>
            <th></th>
            <th></th>
            <th></th>
            <th><b>Sub Total:<fmt:formatNumber value="${sessionScope.cart.subTotal}"
                                               pattern="$#,##0.00" /></b></th>
        </tr>

    </table>
</form>

    <a href="finalOrder" class="Button">submit</a><br>
    <a href="newOrderForm" class="Button">there is something wrong, back to rewrite</a>
</div>

<%@ include file="../common/bottom.jsp"%>

